home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / srcuc.zip / FASL.H < prev    next >
C/C++ Source or Header  |  1990-10-05  |  5KB  |  133 lines

  1. /* -*-C-*-
  2.  
  3. $Header: fasl.h,v 9.32 90/10/05 18:58:53 GMT jinx Exp $
  4.  
  5. Copyright (c) 1987, 1988, 1989 Massachusetts Institute of Technology
  6.  
  7. This material was developed by the Scheme project at the Massachusetts
  8. Institute of Technology, Department of Electrical Engineering and
  9. Computer Science.  Permission to copy this software, to redistribute
  10. it, and to use it for any purpose is granted, subject to the following
  11. restrictions and understandings.
  12.  
  13. 1. Any copy made of this software must include this copyright notice
  14. in full.
  15.  
  16. 2. Users of this software agree to make their best efforts (a) to
  17. return to the MIT Scheme project any improvements or extensions that
  18. they make, so that these may be included in future releases; and (b)
  19. to inform MIT of noteworthy uses of this software.
  20.  
  21. 3. All materials developed as a consequence of the use of this
  22. software shall duly acknowledge such use, in accordance with the usual
  23. standards of acknowledging credit in academic research.
  24.  
  25. 4. MIT has made no warrantee or representation that the operation of
  26. this software will be error-free, and MIT is under no obligation to
  27. provide any services, by way of maintenance, update, or otherwise.
  28.  
  29. 5. In conjunction with products arising from the use of this material,
  30. there shall be no use of the name of the Massachusetts Institute of
  31. Technology nor of any adaptation thereof in any advertising,
  32. promotional, or sales literature without prior written consent from
  33. MIT in each case. */
  34.  
  35. /* Contains information relating to the format of FASL files.
  36.    The machine/opsys information is contained in config.h
  37.    The processor and compiled code version information is
  38.    contained in the appropriate cmp* file, or compiler.c */
  39.  
  40. /* FASL Version */
  41.  
  42. #define FASL_FILE_MARKER    0xFAFAFAFA
  43.  
  44. /* The FASL file has a header which begins as follows: */
  45.  
  46. #define FASL_HEADER_LENGTH    50    /* Scheme objects in header */
  47.  
  48. #define FASL_Offset_Marker    0    /* Marker to indicate FASL format */
  49. #define FASL_Offset_Heap_Count    1    /* Count of objects in heap */
  50. #define FASL_Offset_Heap_Base    2    /* Address of heap when dumped */
  51. #define FASL_Offset_Dumped_Obj    3    /* Where dumped object was */
  52. #define FASL_Offset_Const_Count    4    /* Count of objects in const. area */
  53. #define FASL_Offset_Const_Base    5    /* Address of const. area at dump */
  54. #define FASL_Offset_Version    6    /* FASL format version info. */
  55. #define FASL_Offset_Stack_Top    7    /* Top of stack when dumped */
  56. #define FASL_Offset_Prim_Length 8    /* Number of entries in primitive table */
  57. #define FASL_Offset_Prim_Size    9    /* Size of primitive table in SCHEME_OBJECTs */
  58. #define FASL_Offset_Ci_Version    10    /* Version number for compiled code interface */
  59. #define FASL_Offset_Ut_Base    11    /* Address of the utilities vector */
  60. #define FASL_Offset_Check_Sum    12    /* Header and data checksum. */
  61.  
  62. #define FASL_Offset_First_Free    13    /* Used to clear header */
  63.  
  64. /* Aliases for backwards compatibility. */
  65.  
  66. /* Where ext. prims. vector is */
  67. #define FASL_Offset_Ext_Loc    FASL_Offset_Prim_Length
  68.  
  69. /* Version information encoding */
  70.  
  71. #define MACHINE_TYPE_LENGTH    (OBJECT_LENGTH / 2)
  72. #define MACHINE_TYPE_MASK    ((1 << MACHINE_TYPE_LENGTH) - 1)
  73. #define The_Machine_Type(P)    ((P) & MACHINE_TYPE_MASK)
  74. #define SUBVERSION_LENGTH    (MACHINE_TYPE_LENGTH - TYPE_CODE_LENGTH)
  75. #define SUBVERSION_MASK        ((1 << SUBVERSION_LENGTH) - 1)
  76. #define The_Sub_Version(P)    (((P) >> MACHINE_TYPE_LENGTH) & SUBVERSION_MASK)
  77. #define The_Version(P)        OBJECT_TYPE (P)
  78. #define Make_Version(V, S, M)                    \
  79.   MAKE_OBJECT ((V), (((S) << MACHINE_TYPE_LENGTH) | (M)))
  80.  
  81. #define CI_MASK            ((1 << (DATUM_LENGTH / 2)) - 1)
  82. #define CI_VERSION(P)        (((P) >> (DATUM_LENGTH / 2)) & CI_MASK)
  83. #define CI_PROCESSOR(P)        ((P) & CI_MASK)
  84. #define CI_BAND_P(P)        (OBJECT_TYPE (P) == TC_TRUE)
  85. #define MAKE_CI_VERSION(Band_p, Version, Processor_Type)    \
  86.   MAKE_OBJECT (((Band_p) ? TC_TRUE : TC_NULL),            \
  87.            (((Version) << (DATUM_LENGTH / 2)) |        \
  88.             (Processor_Type)))
  89.  
  90. /* "Memorable" FASL versions -- ones where we modified something
  91.    and want to remain backwards compatible.
  92. */
  93.  
  94. /* Versions. */
  95.  
  96. #define FASL_FORMAT_ADDED_STACK    1
  97.  
  98. /* Subversions of highest numbered version. */
  99.  
  100. #define FASL_LONG_HEADER    3
  101. #define FASL_DENSE_TYPES    4
  102. #define FASL_PADDED_STRINGS    5
  103. #define FASL_REFERENCE_TRAP    6
  104. #define FASL_MERGED_PRIMITIVES    7
  105. #define FASL_INTERFACE_VERSION    8
  106. #define FASL_NEW_BIGNUMS    9
  107.  
  108. /* Current parameters.  Always used on output. */
  109.  
  110. #define FASL_FORMAT_VERSION    FASL_FORMAT_ADDED_STACK
  111. #define FASL_SUBVERSION        FASL_NEW_BIGNUMS
  112.  
  113. /*
  114.   The definitions below correspond to the ones above.  They usually
  115.   have the same values.  They differ when the format is changing: A
  116.   system can be built which reads the old format, but dumps the new one.
  117.  */
  118.  
  119. #ifndef FASL_READ_VERSION
  120. #define FASL_READ_VERSION    FASL_FORMAT_VERSION
  121. #endif
  122.  
  123. #ifndef FASL_READ_SUBVERSION
  124. #define FASL_READ_SUBVERSION    FASL_SUBVERSION
  125. #endif
  126.  
  127. /* These are for Bintopsb.
  128.    They are the values of the oldest supported formats.
  129.  */
  130.  
  131. #define FASL_OLDEST_VERSION    FASL_FORMAT_ADDED_STACK
  132. #define FASL_OLDEST_SUBVERSION    FASL_PADDED_STRINGS
  133.